PDF Plugin for Xojo

Page.Clip Method (console safe)

Sets clipping path to the current path.

Clip()

Parameters

Remarks

Note there is no way to go back to the full page by some command, so what you do is you save the Graphics state and restore it when you want to go out of the clipping path.

Calling the Clip method does not end the current path object, so you need to call either Draw or EndPath if you want to avoid drawing (which you probably usually want to do when setting clipping).

Example:


myPage.SaveState() // We save the graphics state since else there is no way to get the clipping back to the full page

// Create circular clipping path in middle of the Dark rectangle
myPage.Ellipse(300,500,150,150)
myPage.Clip()
myPage.EndPath() // We need to do this since Clip does not actually close the path, clipping will not work without this line

// Fill blue rectangle over the dark rectangle, since we are in clipping state then only the clipping circle gets filled
myPage.FillColor = &c0000FF
myPage.Rectangle(100,300,400,400)
myPage.Fill()

// We make two white, rectangles, and we are still in the clipping path
myPage.FillColor = &cFFFFFF
myPage.Rectangle(300,300,200,200)
myPage.Rectangle(100,500,200,200)
myPage.Fill()

myPage.RestoreState() // Restore our state, expanding the Clipping back to the full page

See Also

Page Class